/** *******************************************************************
 * FlexDatabaseManager
 * @author  Jonnie Spratley
 * @contact jonniespratley@gmail.com
 * @internal
 ******************************************************************* */
package com.jonniespratley.flexdatabasemanager.vo
{	

	[RemoteClass]
	[Bindable]
	public class BackupVO extends Object
	{
		public var aFilename:String;
		public var aSize:String;
		public var aCreated:String;
		public var aType:String;
		public var aTable:String;
		public var aDatabase:String;
		public var aCompressed:String;
		public var isDir:String;
		public var isFile:String;
		public var isWritable:String;
		public var isReadable:String;
		public var aPermissions:String;
		public var aOwner:String;
		
		public function  BackupVO( obj:Object = null )
		{			
			if ( obj != null )
			{
				this.aFilename = obj['aFilename'];
				this.aSize = obj['aSize'];
				this.aCreated = obj['aCreated'];
				this.aType = obj['aType'];
				this.aDatabase = obj['aDatabase'];
				this.aPermissions = obj['aPermissions'];
				this.isDir = obj['isDir'];
				this.isFile = obj['isFile'];
				this.isReadable = obj['isReadable'];
				this.isWritable = obj['isWritable'];
			} 
		}
		
		public function get label():String
		{
			return aFilename + ' ' + aType;
		}
		
		public function get data():Object
		{
			return 'file';
		}
		
		public function get filename():String
		{
			var filename:String = '';
			
			if ( isDirectory )
			{
				filename = aFilename;
			}
		
			return filename;
		}
		
		public function get isDirectory():Boolean
		{
			var dir:Boolean = false;
			
			if ( isDir == 'true' )
			{
				dir = true;
			} else if ( isDir == 'false' )
			{
				dir = false;
			}
			return dir;
		}
	}
}